import request from '@/utils/request'
var baseUrl = '/user/liveSharing'
export function queryAllLivingShare(page,size,message) {
  return request({
    url: '/user/liveSharing/findAllLiveSharing',
    method: 'post',
    params: {page,size,message}
  })
}


export function addCollectionLove(id, type) {
  return request({
    url: '/user/liveSharing/loveCollection',
    method: 'post',
    params: {id,type}
  })
}

export function updateLivingMinio(id, imageUrl) {
  return request({
    url: '/user/liveSharing/updateLivingMinio',
    method: 'post',
    params: {id,imageUrl}
  })
}

export function getCollectionLove(id, type) {
  return request({
    url: '/user/liveSharing/getNumLoveCollection',
    method: 'get',
    params: {id,type}
  })
}

export function getDetailShare(id) {
  return request({
    url: '/user/liveSharing/getDetailShare',
    method: 'get',
    params: {id}
  })
}

export function upImage(formData) {
  return request({
    url: '/user/liveSharing/uploadImage',
    method: 'post',
    data: formData,
    headers: {'Content-Type':'multipart/form-data'}
  })
}

export function addShare() {
  return request({
    url: '/user/liveSharing/addShare',
    method: 'post'
  })
}

export function closeSave(updateShare) {
  return request({
    url: '/user/liveSharing/closeSave',
    method: 'post',
    data: updateShare
  })
}

export function save(updateShare) {
  return request({
    url: '/user/liveSharing/save',
    method: 'post',
    data: updateShare
  })
}

/**
 * 获取全部评论
 * @returns {AxiosPromise}
 */
export function getAllComments(id, type) {
  return request({
    url: '/user/comment/getAllComment',
    method: 'get',
    params: {id, type}
  })
}

/**
 * 添加父评论
 * @param addParentComment
 * @returns {AxiosPromise}
 */
export function addParentComment(addParentComment) {
  return request({
    url: '/user/comment/addParentComment',
    method: 'post',
    data: addParentComment
  })
}

export function delComment(id,type) {
  return request({
    url: '/user/comment/deleteComment',
    method: 'post',
    params: {id,type}
  })
}

/**
 * 添加子评论
 * @param addParentComment
 * @returns {AxiosPromise}
 */
export function addSonComment(addSonComment) {
  return request({
    url: '/user/comment/addSonComment',
    method: 'post',
    data: addSonComment
  })
}
